package com.schoolcloud.files.controller;

import com.schoolcloud.common.model.R;
import com.schoolcloud.files.entity.FileUploadScene;
import com.schoolcloud.files.service.FileUploadSceneService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/file/scene")
@RequiredArgsConstructor
public class FileSceneController {
    private final FileUploadSceneService fileUploadSceneService;
    @GetMapping("/list")
    public R<List<FileUploadScene>> getSceneList() {
        return R.ok(fileUploadSceneService.list());
    }
    @PostMapping
    public R<FileUploadScene> addScene(@RequestBody FileUploadScene fileUploadScene) {
        fileUploadSceneService.save(fileUploadScene);
        return R.ok(fileUploadScene);
    }
    @PutMapping
    public R<FileUploadScene> updateScene(@RequestBody FileUploadScene fileUploadScene) {
        fileUploadSceneService.updateById(fileUploadScene);
        return R.ok(fileUploadScene);
    }
}
